package com.xcity.game.activity2.singlerecharge.template;

import com.xcity.game.item.ItemInfo;

import naga.x.game.template.Template;
import naga.x.game.template.TemplateException;
import naga.x.game.template.annotation.Excel;

/**
 * 单笔充值活动
 * @author yang.li
 *
 */
@Excel(value = "single_recharge.xlsx", sheet = 0)
public class SingleRechargeActivityTemplate extends Template {

	/** 充值金额 */
	protected int money;

	/** 限领次数 */
	protected int numLimit;

	/** 物品列表 */
	protected int[] items;
	protected ItemInfo[] itemsWrapped;

	public int getMoney() {
		return money;
	}

	public void setMoney(int money) {
		this.money = money;
	}

	public int getNumLimit() {
		return numLimit;
	}

	public void setNumLimit(int numLimit) {
		this.numLimit = numLimit;
	}

	public int[] getItems() {
		return items;
	}

	public void setItems(int[] items) {
		this.items = items;
	}

	public ItemInfo[] getItemsWrapped() {
		return itemsWrapped;
	}

	@Override
	public void validate() throws TemplateException {
		itemsWrapped = new ItemInfo[items.length >> 1];
		for (int i = 0; i < itemsWrapped.length; i++) {
			itemsWrapped[i] = new ItemInfo(items[i << 1], items[(i << 1) + 1]);
		}
	}
}
